<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Blog List</title>
</head>
<body>
<h2>Blog List</h2>

<?php
$dbh = new PDO('mysql:host=localhost;dbname=blog' ,
                'root' , '' );

function getBlogs($dbh) {
    $sql = "SELECT * FROM blogList";
    $blogs = $dbh->query($sql)->fetchAll();
    return $blogs;
}

$blogs = getBlogs($dbh);
foreach($blogs as $blog) {
    echo htmlentities($blog['blogTitle'], ENT_QUOTES);
	  echo "  ";
		echo htmlentities($blog['blogText'], ENT_QUOTES); 
    echo '<br/>';
}
?>
<br/><br/>
<a href="/blog_Home.php">
<img src="Images/home_button.gif" alt="Blog Page"/></a>
</body>
</html>